.class public Lorg/zeam/ApplicationsGridView;
.super Landroid/widget/GridView;
.source "ApplicationsGridView.java"

# interfaces
.implements Lorg/zeam/ApplicationsView;
.implements Landroid/widget/AdapterView$OnItemClickListener;
.implements Landroid/widget/AdapterView$OnItemLongClickListener;
.implements Lorg/zeam/DragSource;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "Landroid/widget/GridView;",
        "Lorg/zeam/ApplicationsView;",
        "Landroid/widget/AdapterView$OnItemClickListener;",
        "Landroid/widget/AdapterView$OnItemLongClickListener;",
        "Lorg/zeam/DragSource;"
    }
.end annotation


# instance fields
.field private mDragController:Lorg/zeam/DragController;

.field private mLauncher:Lorg/zeam/Launcher;

.field public mMode:I

.field private mResetMode:Z


# direct methods
.method public constructor <init>(Landroid/content/Context;)V
    .locals 1
    .parameter "context"

    .prologue
    .line 25
    invoke-direct {p0, p1}, Landroid/widget/GridView;-><init>(Landroid/content/Context;)V

    .line 22
    const/4 v0, 0x0

    iput v0, p0, Lorg/zeam/ApplicationsGridView;->mMode:I

    .line 26
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;)V
    .locals 1
    .parameter "context"
    .parameter "attrs"

    .prologue
    .line 29
    const v0, 0x1010071

    invoke-direct {p0, p1, p2, v0}, Lorg/zeam/ApplicationsGridView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 30
    return-void
.end method

.method public constructor <init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V
    .locals 2
    .parameter "context"
    .parameter "attrs"
    .parameter "defStyle"

    .prologue
    const/4 v0, 0x1

    const/4 v1, 0x0

    .line 33
    invoke-direct {p0, p1, p2, p3}, Landroid/widget/GridView;-><init>(Landroid/content/Context;Landroid/util/AttributeSet;I)V

    .line 22
    iput v1, p0, Lorg/zeam/ApplicationsGridView;->mMode:I

    .line 35
    iput-boolean v0, p0, Lorg/zeam/ApplicationsGridView;->mResetMode:Z

    .line 36
    invoke-static {p1, v0}, Lorg/zeam/SelectorDrawable;->createSelector(Landroid/content/Context;Z)Lorg/zeam/SelectorDrawable;

    move-result-object v0

    invoke-virtual {p0, v0}, Lorg/zeam/ApplicationsGridView;->setSelector(Landroid/graphics/drawable/Drawable;)V

    .line 37
    invoke-virtual {p0, v1}, Lorg/zeam/ApplicationsGridView;->setTextFilterEnabled(Z)V

    .line 38
    return-void
.end method


# virtual methods
.method public close(Z)Z
    .locals 3
    .parameter "animated"

    .prologue
    const/4 v2, 0x1

    const/4 v1, 0x0

    .line 144
    iget v0, p0, Lorg/zeam/ApplicationsGridView;->mMode:I

    if-eqz v0, :cond_1

    .line 145
    iget-boolean v0, p0, Lorg/zeam/ApplicationsGridView;->mResetMode:Z

    if-eqz v0, :cond_0

    .line 146
    invoke-virtual {p0, v1}, Lorg/zeam/ApplicationsGridView;->setMode(I)V

    .line 148
    :cond_0
    iput-boolean v2, p0, Lorg/zeam/ApplicationsGridView;->mResetMode:Z

    move v0, v1

    .line 156
    :goto_0
    return v0

    .line 151
    :cond_1
    if-eqz p1, :cond_2

    .line 152
    invoke-virtual {p0}, Lorg/zeam/ApplicationsGridView;->getContext()Landroid/content/Context;

    move-result-object v0

    const v1, 0x7f040001

    invoke-static {v0, v1}, Landroid/view/animation/AnimationUtils;->loadAnimation(Landroid/content/Context;I)Landroid/view/animation/Animation;

    move-result-object v0

    invoke-virtual {p0, v0}, Lorg/zeam/ApplicationsGridView;->setAnimation(Landroid/view/animation/Animation;)V

    .line 154
    :cond_2
    const/4 v0, 0x4

    invoke-virtual {p0, v0}, Lorg/zeam/ApplicationsGridView;->setVisibility(I)V

    .line 155
    invoke-virtual {p0}, Lorg/zeam/ApplicationsGridView;->invalidate()V

    move v0, v2

    .line 156
    goto :goto_0
.end method

.method public getImplementingView()Landroid/view/View;
    .locals 0

    .prologue
    .line 175
    return-object p0
.end method

.method public getLauncher()Lorg/zeam/Launcher;
    .locals 1

    .prologue
    .line 180
    iget-object v0, p0, Lorg/zeam/ApplicationsGridView;->mLauncher:Lorg/zeam/Launcher;

    return-object v0
.end method

.method public onDestroy()V
    .locals 1

    .prologue
    .line 169
    invoke-virtual {p0}, Lorg/zeam/ApplicationsGridView;->clearTextFilter()V

    .line 170
    const/4 v0, 0x0

    invoke-virtual {p0, v0}, Lorg/zeam/ApplicationsGridView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 171
    return-void
.end method

.method public onDropCompleted(Landroid/view/View;Z)V
    .locals 0
    .parameter "target"
    .parameter "success"

    .prologue
    .line 122
    return-void
.end method

.method protected onFinishInflate()V
    .locals 0

    .prologue
    .line 77
    invoke-virtual {p0, p0}, Lorg/zeam/ApplicationsGridView;->setOnItemClickListener(Landroid/widget/AdapterView$OnItemClickListener;)V

    .line 78
    invoke-virtual {p0, p0}, Lorg/zeam/ApplicationsGridView;->setOnItemLongClickListener(Landroid/widget/AdapterView$OnItemLongClickListener;)V

    .line 79
    return-void
.end method

.method public onItemClick(Landroid/widget/AdapterView;Landroid/view/View;IJ)V
    .locals 3
    .parameter "parent"
    .parameter "v"
    .parameter "position"
    .parameter "id"

    .prologue
    .line 83
    invoke-virtual {p1, p3}, Landroid/widget/AdapterView;->getItemAtPosition(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lorg/zeam/ApplicationItemInfo;

    .line 85
    .local v0, applicationItemInfo:Lorg/zeam/ApplicationItemInfo;
    iget v1, p0, Lorg/zeam/ApplicationsGridView;->mMode:I

    packed-switch v1, :pswitch_data_0

    .line 99
    :cond_0
    :goto_0
    return-void

    .line 87
    :pswitch_0
    const/4 v1, 0x1

    iput-boolean v1, p0, Lorg/zeam/ApplicationsGridView;->mResetMode:Z

    .line 88
    iget-object v1, p0, Lorg/zeam/ApplicationsGridView;->mLauncher:Lorg/zeam/Launcher;

    iget-object v2, v0, Lorg/zeam/ApplicationItemInfo;->intent:Landroid/content/Intent;

    invoke-virtual {v1, v2}, Lorg/zeam/Launcher;->startActivitySafely(Landroid/content/Intent;)V

    goto :goto_0

    .line 91
    :pswitch_1
    invoke-virtual {p0}, Lorg/zeam/ApplicationsGridView;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-static {v1, v0}, Lorg/zeam/Utilities;->canUninstallApplication(Landroid/content/Context;Lorg/zeam/ApplicationItemInfo;)Z

    move-result v1

    if-eqz v1, :cond_0

    .line 92
    const/4 v1, 0x0

    iput-boolean v1, p0, Lorg/zeam/ApplicationsGridView;->mResetMode:Z

    .line 93
    iget-object v1, p0, Lorg/zeam/ApplicationsGridView;->mLauncher:Lorg/zeam/Launcher;

    invoke-virtual {v1, v0}, Lorg/zeam/Launcher;->uninstallApplication(Lorg/zeam/ApplicationItemInfo;)V

    goto :goto_0

    .line 85
    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method

.method public onItemLongClick(Landroid/widget/AdapterView;Landroid/view/View;IJ)Z
    .locals 4
    .parameter
    .parameter "view"
    .parameter "position"
    .parameter "id"
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/widget/AdapterView",
            "<*>;",
            "Landroid/view/View;",
            "IJ)Z"
        }
    .end annotation

    .prologue
    .local p1, parent:Landroid/widget/AdapterView;,"Landroid/widget/AdapterView<*>;"
    const/4 v3, 0x1

    const/4 v2, 0x0

    .line 103
    iget v1, p0, Lorg/zeam/ApplicationsGridView;->mMode:I

    if-nez v1, :cond_1

    .line 104
    invoke-virtual {p2}, Landroid/view/View;->isInTouchMode()Z

    move-result v1

    if-nez v1, :cond_0

    move v1, v2

    .line 114
    :goto_0
    return v1

    .line 107
    :cond_0
    new-instance v0, Lorg/zeam/ApplicationItemInfo;

    .line 108
    invoke-virtual {p1, p3}, Landroid/widget/AdapterView;->getItemAtPosition(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lorg/zeam/ApplicationItemInfo;

    .line 107
    invoke-direct {v0, v1}, Lorg/zeam/ApplicationItemInfo;-><init>(Lorg/zeam/ApplicationItemInfo;)V

    .line 110
    .local v0, applicationItemInfo:Lorg/zeam/ApplicationItemInfo;
    iget-object v1, p0, Lorg/zeam/ApplicationsGridView;->mDragController:Lorg/zeam/DragController;

    invoke-interface {v1, p2, p0, v0, v3}, Lorg/zeam/DragController;->startDrag(Landroid/view/View;Lorg/zeam/DragSource;Ljava/lang/Object;I)V

    .line 111
    iget-object v1, p0, Lorg/zeam/ApplicationsGridView;->mLauncher:Lorg/zeam/Launcher;

    invoke-virtual {v1}, Lorg/zeam/Launcher;->closeAllApplications()V

    move v1, v3

    .line 112
    goto :goto_0

    .end local v0           #applicationItemInfo:Lorg/zeam/ApplicationItemInfo;
    :cond_1
    move v1, v2

    .line 114
    goto :goto_0
.end method

.method public open(Z)V
    .locals 3
    .parameter "animated"

    .prologue
    const/4 v2, 0x0

    .line 131
    invoke-virtual {p0}, Lorg/zeam/ApplicationsGridView;->getContext()Landroid/content/Context;

    move-result-object v0

    .line 132
    .local v0, context:Landroid/content/Context;
    invoke-static {v0}, Lorg/zeam/PreferencesUtil;->rememberApplicationsPosition(Landroid/content/Context;)Z

    move-result v1

    if-nez v1, :cond_0

    .line 133
    invoke-virtual {p0, v2}, Lorg/zeam/ApplicationsGridView;->setSelection(I)V

    .line 135
    :cond_0
    if-eqz p1, :cond_1

    .line 136
    const/high16 v1, 0x7f04

    invoke-static {v0, v1}, Landroid/view/animation/AnimationUtils;->loadAnimation(Landroid/content/Context;I)Landroid/view/animation/Animation;

    move-result-object v1

    invoke-virtual {p0, v1}, Lorg/zeam/ApplicationsGridView;->setAnimation(Landroid/view/animation/Animation;)V

    .line 138
    :cond_1
    invoke-virtual {p0, v2}, Lorg/zeam/ApplicationsGridView;->setVisibility(I)V

    .line 139
    invoke-virtual {p0}, Lorg/zeam/ApplicationsGridView;->invalidate()V

    .line 140
    return-void
.end method

.method public setApplications(Ljava/util/ArrayList;)V
    .locals 2
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Lorg/zeam/ApplicationItemInfo;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 162
    .local p1, applicationItemInfos:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lorg/zeam/ApplicationItemInfo;>;"
    invoke-virtual {p0}, Lorg/zeam/ApplicationsGridView;->getContext()Landroid/content/Context;

    move-result-object v0

    .line 163
    .local v0, context:Landroid/content/Context;
    new-instance v1, Lorg/zeam/ApplicationsAdapter;

    invoke-direct {v1, v0, p1}, Lorg/zeam/ApplicationsAdapter;-><init>(Landroid/content/Context;Ljava/util/ArrayList;)V

    invoke-virtual {p0, v1}, Lorg/zeam/ApplicationsGridView;->setAdapter(Landroid/widget/ListAdapter;)V

    .line 164
    return-void
.end method

.method public setBackgroundAlpha(I)V
    .locals 1
    .parameter "alpha"

    .prologue
    const/4 v0, 0x0

    .line 43
    invoke-static {p1, v0, v0, v0}, Landroid/graphics/Color;->argb(IIII)I

    move-result v0

    invoke-virtual {p0, v0}, Lorg/zeam/ApplicationsGridView;->setBackgroundColor(I)V

    .line 44
    invoke-virtual {p0}, Lorg/zeam/ApplicationsGridView;->invalidate()V

    .line 45
    return-void
.end method

.method public setDragController(Lorg/zeam/DragController;)V
    .locals 0
    .parameter "dragController"

    .prologue
    .line 118
    iput-object p1, p0, Lorg/zeam/ApplicationsGridView;->mDragController:Lorg/zeam/DragController;

    .line 119
    return-void
.end method

.method public setLauncher(Lorg/zeam/Launcher;)V
    .locals 0
    .parameter "launcher"

    .prologue
    .line 126
    iput-object p1, p0, Lorg/zeam/ApplicationsGridView;->mLauncher:Lorg/zeam/Launcher;

    .line 127
    return-void
.end method

.method public setMode(I)V
    .locals 5
    .parameter "mode"

    .prologue
    const/4 v4, 0x1

    const/4 v3, 0x0

    .line 49
    iget v2, p0, Lorg/zeam/ApplicationsGridView;->mMode:I

    if-ne v2, p1, :cond_0

    .line 50
    invoke-virtual {p0, v3}, Lorg/zeam/ApplicationsGridView;->setMode(I)V

    .line 72
    :goto_0
    return-void

    .line 53
    :cond_0
    invoke-virtual {p0}, Lorg/zeam/ApplicationsGridView;->getContext()Landroid/content/Context;

    move-result-object v1

    .line 54
    .local v1, context:Landroid/content/Context;
    invoke-virtual {p0}, Lorg/zeam/ApplicationsGridView;->getAdapter()Landroid/widget/ListAdapter;

    move-result-object v0

    check-cast v0, Lorg/zeam/ApplicationsAdapter;

    .line 56
    .local v0, applicationsAdapter:Lorg/zeam/ApplicationsAdapter;
    packed-switch p1, :pswitch_data_0

    .line 71
    :goto_1
    iput p1, p0, Lorg/zeam/ApplicationsGridView;->mMode:I

    goto :goto_0

    .line 59
    :pswitch_0
    invoke-static {v1, v4}, Lorg/zeam/SelectorDrawable;->createSelector(Landroid/content/Context;Z)Lorg/zeam/SelectorDrawable;

    move-result-object v2

    invoke-virtual {p0, v2}, Lorg/zeam/ApplicationsGridView;->setSelector(Landroid/graphics/drawable/Drawable;)V

    .line 60
    invoke-virtual {v0, v3}, Lorg/zeam/ApplicationsAdapter;->setUninstalling(Z)V

    .line 61
    invoke-virtual {v0}, Lorg/zeam/ApplicationsAdapter;->notifyDataSetChanged()V

    goto :goto_1

    .line 64
    :pswitch_1
    const v2, 0x106000d

    invoke-virtual {p0, v2}, Lorg/zeam/ApplicationsGridView;->setSelector(I)V

    .line 65
    invoke-virtual {v0, v4}, Lorg/zeam/ApplicationsAdapter;->setUninstalling(Z)V

    .line 66
    invoke-virtual {v0}, Lorg/zeam/ApplicationsAdapter;->notifyDataSetChanged()V

    goto :goto_1

    .line 56
    nop

    :pswitch_data_0
    .packed-switch 0x0
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method
